#ifndef TRANSPILER_H
#define TRANSPILER_H

#include <list>
#include <map>
#include <string>

class AstCodeBlock;

class Place
{
public:
    std::string Id;
    std::string Name;
    std::string Colset;
    std::string Marking;
};

class Transition
{
public:
    std::string Id;
    std::string Guard;
};

class Connections
{
public:
    std::list<Transition* > Incoming;
    std::list<Transition* > Outgoing;
};

class Transpiler
{
public:
    Transpiler();
    ~Transpiler();

    std::string transpile(AstCodeBlock* code);

private:
    void sortStatements(AstCodeBlock* code);
    bool checkSemanticErrors() const;
    std::string generateXml() const;

private:
    AstCodeBlock* m_code;
    std::map<std::string, Place* > m_places;
    std::map<std::string, Transition* > m_transitions;
    std::map<Place*, Connections* > m_connections;
};

#endif
